package nr.co.mhgames.polyanim;

import java.util.Locale;

/** A class that encapsulates a key frame with its duration (in seconds). */
public class TimedKeyFrame {
	/** The key frame */
	protected KeyFrame frame;

	/** Frame duration in seconds */
	protected float duration;


	/** Default constructor */
	public TimedKeyFrame() {
		frame = null;
		duration = 0;
	}

	/**
	 * Another constructor.
	 * 
	 * @param frame
	 *            Key frame to encapsulate
	 * @param duration
	 *            Frame duration in seconds
	 */
	public TimedKeyFrame(KeyFrame frame, float duration) {
		this.frame = frame;
		this.duration = duration;
	}


	/** Return the key frame */
	public KeyFrame getFrame() {
		return frame;
	}

	/** Set the key frame */
	public void setFrame(KeyFrame frame) {
		this.frame = frame;
	}

	/** Return the frame duration */
	public float getDuration() {
		return duration;
	}

	/** Set the frame duration */
	public void setDuration(float duration) {
		this.duration = duration;
	}


	@Override
	public String toString() {
		return String.format((Locale) null, "TimedKeyFrame: duration %.2fs, %s", getDuration(),
				super.toString());
	}
}
